<template>
	<view>
		<view class="container">
			<!-- <view class="course-tab mlr30 flex-box">
				<view v-for="(item, index) in courseTabList" :class="{ active: courseTabCurrent === index }" @click="courseTabClick(index)" class="tab-item flex-1">{{ item }}</view>
			</view> -->
			<!--  -->
			<view class="plr30 ptb10">
				<block v-if="courseTabCurrent == 0">
					<view class="course-list2">
						<navigator :url="'/pages/course_video_detail/course_video_detail?course_id='+item.course.id" class="nav-course flex-box ptb30" hover-class="none" v-for="(item,index) in courseLists">
							<!-- <view class="time-long">00:08:00</view> -->
							<image class="img-course mr20" :src="item.course.thumb_image" mode="aspectFill"></image>
							<view class="flex-1">
								<view class="m-ellipsis fs26 col-0 mb10">{{item.course.name}}</view>
								<view class="m-ellipsis fs22 col-6 mb30">{{item.course.description}}</view>
								<view class="flex-box">
									<image class="icon1 mr10" v-if="item.course.type==1" src="/static/icon/icon_tv.png" mode="aspectFit"></image>
									<image class="icon1 mr10" v-if="item.course.type==2" src="/static/icon/icon_tv.png" mode="aspectFit"></image>
									<image class="icon1 mr10" v-if="item.course.type==3" src="/static/icon/icon_tv.png" mode="aspectFit"></image>
									<!-- <view class="flex-1 fs22 col-9">课程已上3课时</view> -->
								</view>
							</view>
						</navigator>
						<view class="g-btn3-wrap">
							<view class="g-btn3"  :class="{nomore: courseListsMore.nomore == true || courseListsMore.loading == true}" @click="fetch()">{{courseListsMore.text}}</view>
						</view>
					</view>
				</block>
				<block v-else-if="courseTabCurrent == 1">
					<view class="offline_course">
						<navigator class="item mb40" url="#" hover-class="none">
							<view class="img-box pr mb25">
								<image src="/static/images/img_kechen1.png" mode="aspectFill"></image>
								<view class="tc fs20 col-f status1">进行中</view>
							</view>
							<view class="mb25 fs28 col-black fwb m-ellipsis">如何0成本快速倍增利润如何0成本快速倍速倍增利润...</view>
							<view class="flex-box mb25">
								<view class="g-price1 flex-1 fwb">10000</view>
								<image class="icon1 mr10" src="/static/icon/icon_already.png" mode="aspectFit"></image>
								<view class="fs22 col-9">已报名1480人 | 剩余1480人</view>
							</view>
							<view class="flex-box mb25">
								<image class="icon1 mr20" src="/static/icon/icon_time1.png" mode="aspectFit"></image>
								<view class="fs26 col-3 flex-1">开课时间：2020-02-02 至 2020-02-20</view>
							</view>
							<view class="flex-box">
								<image class="icon1 mr20" src="/static/icon/icon_location.png" mode="aspectFit"></image>
								<view class="fs26 col-3 flex-1">开课地点：上海市徐汇区智慧大道260号</view>
							</view>
						</navigator>
						<navigator class="item mb40" url="#" hover-class="none">
							<view class="img-box pr mb25">
								<image src="/static/images/img_kechen1.png" mode="aspectFill"></image>
								<view class="tc fs20 col-f status1">未开始</view>
							</view>
							<view class="mb25 fs28 col-black fwb m-ellipsis">如何0成本快速倍增利润如何0成本快速倍速倍增利润...</view>
							<view class="flex-box mb25">
								<view class="g-price1 flex-1 fwb">10000</view>
								<image class="icon1 mr10" src="/static/icon/icon_already.png" mode="aspectFit"></image>
								<view class="fs22 col-9">已报名1480人 | 剩余1480人</view>
							</view>
							<view class="flex-box mb25">
								<image class="icon1 mr20" src="/static/icon/icon_time1.png" mode="aspectFit"></image>
								<view class="fs26 col-3 flex-1">开课时间：2020-02-02 至 2020-02-20</view>
							</view>
							<view class="flex-box">
								<image class="icon1 mr20" src="/static/icon/icon_location.png" mode="aspectFit"></image>
								<view class="fs26 col-3 flex-1">开课地点：上海市徐汇区智慧大道260号</view>
							</view>
						</navigator>
						<navigator class="item mb40" url="#" hover-class="none">
							<view class="img-box pr mb25">
								<image src="/static/images/img_kechen1.png" mode="aspectFill"></image>
								<view class="tc fs20 col-f status2">已结束</view>
							</view>
							<view class="mb25 fs28 col-black fwb m-ellipsis">如何0成本快速倍增利润如何0成本快速倍速倍增利润...</view>
							<view class="flex-box mb25">
								<view class="g-price1 flex-1 fwb">10000</view>
								<image class="icon1 mr10" src="/static/icon/icon_already.png" mode="aspectFit"></image>
								<view class="fs22 col-9">已报名1480人 | 剩余1480人</view>
							</view>
							<view class="flex-box mb25">
								<image class="icon1 mr20" src="/static/icon/icon_time1.png" mode="aspectFit"></image>
								<view class="fs26 col-3 flex-1">开课时间：2020-02-02 至 2020-02-20</view>
							</view>
							<view class="flex-box">
								<image class="icon1 mr20" src="/static/icon/icon_location.png" mode="aspectFit"></image>
								<view class="fs26 col-3 flex-1">开课地点：上海市徐汇区智慧大道260号</view>
							</view>
						</navigator>
					</view>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	const util = require('@/xiluedu/util.js');
export default {
	data() {
		return {
			//courseTabList: ['线上课程', '线下课程'],
			courseTabCurrent: 0,
			courseLists:[],
			courseListsMore:{page:1}
		};
	},
	onLoad(){
		this.fetch();
	},
	
	methods: {
		// 点击详情tab
		// courseTabClick(i) {
		// 	this.courseTabCurrent = i;
		// }
		fetch() {
			
		    util.fetch(this, 'xiluedu.user/course_collection', {pagesize:10}, 'courseListsMore', 'courseLists', 'data', data=>{
		    
		    })
		},
	}
};
</script>

<style scoped>
.container {
	overflow-y: unset;
}
.course-tab {
	position: sticky;
	top: 0;
	left: 0;
	right: 0;
	background-color: #fff;
	z-index: 10;
	height: 90rpx;
	border-bottom: 1rpx solid #e1e1e1;
}
.course-tab .tab-item {
	position: relative;
	line-height: 90rpx;
	text-align: center;
	font-size: 28rpx;
	font-weight: 500;
	color: #333;
}
.course-tab .tab-item.active {
	color: var(--red);
}
.course-tab .tab-item.active:before {
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	content: '';
	width: 120rpx;
	height: 4rpx;
	background: var(--red);
	border-radius: 2rpx;
}
/*  */

.course-list2 .img-course {
	display: block;
	width: 280rpx;
	height: 160rpx;
	border-radius: 10rpx;
}
.course-list2 .nav-course + .nav-course {
	border-top: 1rpx solid var(--border);
}
/*  */

.offline_course {
	background-color: #fff;
	border-radius: 10rpx 10rpx 0 0;
}
.offline_course .item {
	width: 100%;
}
.offline_course .img-box {
	width: 100%;
	height: 360rpx;
	border-radius: 10rpx;
	overflow: hidden;
}
.offline_course .img-box image {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 10rpx;
}
.offline_course .img-box .status1 {
	position: absolute;
	top: 0;
	left: 0;
	padding: 0 10rpx;
	height: 34rpx;
	border-radius: 10rpx 0 0 0;
	line-height: 34rpx;
	background: linear-gradient(90deg, #d7aa4e, #f4c972);
}
.offline_course .img-box .status2 {
	position: absolute;
	top: 0;
	left: 0;
	padding: 0 10rpx;
	height: 34rpx;
	border-radius: 10rpx 0 0 0;
	line-height: 34rpx;
	background: #d8d8d8;
}
.offline_course .icon1 {
	display: block;
	width: 30rpx;
	height: 30rpx;
}
@media only screen and (min-width: 800px) {
	.offline_course .img-box{
		height: 800rpx;
		border-radius: 30rpx;
	}
	.offline_course .status1{
		padding-left: 20rpx!important;
	}
	.offline_course .status2{
		padding-left: 20rpx!important;
	}
}
</style>
